<!--
 * @Author: 极客James
 * @Motto: 求知若渴,虚心若愚
 * @Github: https://github.com/Geek-James/ddBuy
 * @掘金: https://juejin.im/user/5c4ebc72e51d4511dc7306ce
 * @LastEditTime: 2019-11-07 09:18:59
 * @Description: 我的->我的订单->订单类型
 * @FilePath: /ddBuy/src/views/mine/Children/MyOrderChildren/OrderType.vue
 <!-- <img src="./../../../../images/mine/noData.jpeg" alt="">
      <span class="desc">{{$t('mine.feedbackTip')}}</span> -->
<template>
  <div id="orderType">

    <div class="noDataPlaceHold">
       <!-- <img src="./../../../../images/mine/noData.jpeg" alt="">
      <span class="desc">{{$t('mine.feedbackTip')}}</span> -->

      <el-table
      :data="tableData"
       stripe
    style="width: 100%"
    >
          <el-table-column prop="creationTime" label="订单号" width="180">
        </el-table-column>
         
        <el-table-column prop="productName" label="商品名称" width="180">
          <template slot-scope="scope">
             <span v-for="(item,index) in scope.row.orderDetailList" :key="index">{{item.productName}}</span>
         </template>
         
        </el-table-column>
        
        <el-table-column prop="orderInfoAddre" label="订单金额" width="180">
          <template slot-scope="scope">
             <span v-for="(item,index) in scope.row.orderDetailList" :key="index">{{item.countPrice}}</span>
         </template>
        </el-table-column>
        
        <el-table-column label="操作">
          <template slot-scope="scope">
            <!-- <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
              >去支付</el-button
            >
            <el-button
              size="mini"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            > -->
            <div v-if="scope.row.orderInfoState==1">
             <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
              >去支付</el-button
            >
            <el-button
              size="mini"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            >
            </div>
           <div v-if="scope.row.orderInfoState===2">
             <el-button size="mini" @click="handleEdit1(scope.$index, scope.row)"
              >查看物流</el-button
            >
            <el-button
              size="mini"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            >
            </div>
              <div v-if="scope.row.orderInfoState===3">
             <el-button size="mini" @click="handleEdit2(scope.$index, scope.row)"
              >评价</el-button
            >
            <el-button
              size="mini"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            >
            </div>
              <!-- <div v-if="scope.row.orderInfoState===3">
             <el-button size="mini" @click="handleEdit3(scope.$index, scope.row)"
              >退货</el-button
            >
            <el-button
              size="mini"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            >
            </div> -->
            </template>
          </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script type="text/javascript">
export default {
  props: {
    orderTypeDataArray: Array
  },

  data () {
    return {
       tableData: [],
       listQuery: {
        page: 1,
        limit: 5,
        skipCount: 0,
        maxResultCount: 1000,
        importance: undefined,
        title: undefined,
        productName: undefined,
        orderInfoState: -1,
        orderInfoWaybillNum: undefined,
        sort: '+id'
      },
    }
  },
  components: {},
  methods: {
        handleEdit(index,row){
         alert(row.orderInfoState)
            window.open("https://localhost:44338/api/app/a-li-pay/pay?Subject="+row.orderInfoId
      +'&outTradeNo='+row.orderInfoId+'&totalAmount='+row.orderInfoSalePrice)
      .then((r)=>{
       if(r.data==succes)
       {
         alert(1)
       }
      })
     
     /*
      handleEdit(index,row){
          alert(row.orderInfoState)
            window.open("https://localhost:44338/api/app/a-li-pay/pay?Subject="+123456789
      +'&outTradeNo='+4567889+'&totalAmount='+50)
     */ 
    },
    //显示
    getlist(){
      if(this.orderTypeDataArray[0]==0){
          this.listQuery.orderInfoState=0
      }
      if(this.orderTypeDataArray[0]==1){
          this.listQuery.orderInfoState=1
      }
      if(this.orderTypeDataArray[0]==2){
          this.listQuery.orderInfoState=2
      }
      if(this.orderTypeDataArray[0]==3){
          this.listQuery.orderInfoState=3
      }
       this.$axios
      .get("https://localhost:44338/api/app/orderinfor",{params:this.listQuery})
      .then((r) => {
        this.tableData = r.data;
        console.log(this.listQuery);
        console.log(this.tableData);
      });
    },
    handleDelete(index,row){
      alert(row.id);
    },
    handleEdit1(index,row)
     {
       alert(row.orderInfoState)
     },
     handleEdit2(index,row)
     {
       alert(row.orderInfoState)
     },
     handleEdit3(index,row)
     {
       alert(row.orderInfoState)
     },
  },
    mounted () {
    this.getlist();
  },
}
</script>

<style lang="less" scoped>
#orderType {
  margin-top: 2rem;
  height: 20rem;
  .noDataPlaceHold {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    img {
      width: 60%;
      height: 60%;
    }
    .desc {
      color: grey;
      font-size: 0.6rem;
    }
  }
  .noData {
    margin-top: 3rem;
    width: 100%;
    height: 100%;
    text-align: center;
  }
}
</style>
